Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Travis with Github Actions for CI builds #6071

Merged
merged 3 commits into from
Sep 3, 2021

Conversation

mjjbell
Copy link
Member

@mjjbell mjjbell commented Jul 4, 2021

Issue

This PR replaces Travis for continuous integration with Github Actions.

The Github Actions pipeline is functionally equivalent, with all the same build permutations supported. Whilst the Github Actions offering is broadly equivalent to Travis, a few changes have been made as part of the migration.

The core and optional Travis stages have been consolidated into one build matrix. This is due to the current inability in
Github Actions to share build steps between jobs, so this avoids having to duplicate the steps.
Optional stage jobs will now run in parallel with core jobs, but they still remain optional in the sense that they don't fail the build.

A number of existing Github Action plugins are used to replace functionality provided by Travis or other tools:

Linux builds are updated to build on Ubuntu 18.04. MacOS builds are updated to run on 10.15.
Similar to the Travis Xenial upgrade attempt, some changes are required due to underlying platform and compiler upgrades. This means some Node 10 toolchains will no longer be supported.

Whilst there is opportunity to upgrade build dependencies and make the CI steps more idiomatic, I've left this for future changes and just focussed on functional replication.

Tasklist

Requirements / Relations

Closes #6056

@@ -514,7 +514,7 @@ if(ENABLE_MASON)
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}")

# current mason packages target -D_GLIBCXX_USE_CXX11_ABI=0
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
add_dependency_defines(-D_GLIBCXX_USE_CXX11_ABI=0)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Travis Trusty builds, the compilers all had GLIBCXX_USE_CXX11_ABI=0 by default. This setting has been flipped in Bionic, so we need to explicitly pass this to pkg-config so that the example builds.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot why we had this in the first place. I think this was mason related given that is afaik the only place where we care about ABI of our binaries.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, the Mason Boosts are built against the old ABI .

@@ -244,14 +242,15 @@ bool RestrictionParser::ShouldIgnoreRestriction(const std::string &except_tag_st

// Be warned, this is quadratic work here, but we assume that
// only a few exceptions are actually defined.
std::vector<std::string> exceptions;
boost::algorithm::split_regex(exceptions, except_tag_string, boost::regex("[;][ ]*"));
const std::regex delimiter_re("[;][ ]*");
Copy link
Member Author

@mjjbell mjjbell Jul 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar problem to the Travis Xenial upgrade attempt.
Boost.Regex and GCC5 appears to be buggy with respect to [abi:cxx11] tags, so using this as an opportunity to replace Boost.Regex with std::regex.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@@ -27,7 +26,7 @@ BOOST_AUTO_TEST_CASE(test_json_linestring)
const auto coords = geom.values["coordinates"].get<util::json::Array>().values;
BOOST_CHECK_EQUAL(coords.size(), 3); // array of three location arrays

for (const auto each : coords)
for (const auto &each : coords)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unit test changes are due to compiler errors from updated macOS clang.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This crashes clang?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running make tests with clang 12

error: loop variable 'each' creates a copy from type 'const mapbox::util::variant<osrm::util::json::String, osrm::util::json::Number, mapbox::util::recursive_wrapperosrm::util::json::Object, mapbox::util::recursive_wrapperosrm::util::json::Array, osrm::util::json::True, osrm::util::json::False, osrm::util::json::Null>' [-Werror,-Wrange-loop-construct]
for (const auto each : coords)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see -Werror strikes again.

@mjjbell mjjbell force-pushed the mbell/replace_travis_ga branch from 93e5cc8 to 4784e43 Compare July 4, 2021 21:27
@mjjbell
Copy link
Member Author

mjjbell commented Jul 8, 2021

It looks like Github Actions makes each job have a status check, rather than the action as a whole.

This would be a problem if we want checks to be required because any change to the job matrix would break the required list.

I think a solution is to have a no-op job that depends on all other jobs succeeding, and make this the only required check. That way we get required stability as the jobs evolve.

@mjjbell mjjbell force-pushed the mbell/replace_travis_ga branch 3 times, most recently from 15a910a to 415bd81 Compare July 8, 2021 22:14
@mjjbell
Copy link
Member Author

mjjbell commented Jul 8, 2021

I think a solution is to have a no-op job that depends on all other jobs succeeding, and make this the only required check. That way we get required stability as the jobs evolve.

Added a ci-complete step that can be used as a required check.

@mjjbell
Copy link
Member Author

mjjbell commented Jul 8, 2021

@danpat any thoughts on this?
Given the Travis integration is dead but required, we can't merge anything until it is disabled/replaced.

@TheMarex
Copy link
Member

TheMarex commented Sep 1, 2021

Added myself as reviewer, I'll take a look Friday.

Copy link
Member

@TheMarex TheMarex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks for doing this. I think we can also trim the matrix a bit, there is little sense in supporting the older GCC from 4-5 years ago.

@@ -244,14 +242,15 @@ bool RestrictionParser::ShouldIgnoreRestriction(const std::string &except_tag_st

// Be warned, this is quadratic work here, but we assume that
// only a few exceptions are actually defined.
std::vector<std::string> exceptions;
boost::algorithm::split_regex(exceptions, except_tag_string, boost::regex("[;][ ]*"));
const std::regex delimiter_re("[;][ ]*");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@@ -27,7 +26,7 @@ BOOST_AUTO_TEST_CASE(test_json_linestring)
const auto coords = geom.values["coordinates"].get<util::json::Array>().values;
BOOST_CHECK_EQUAL(coords.size(), 3); // array of three location arrays

for (const auto each : coords)
for (const auto &each : coords)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This crashes clang?

@@ -184,7 +184,7 @@ BOOST_AUTO_TEST_CASE(test_match_fb_serialization)
const auto matchings = fb->routes();
const auto &number_of_matchings = matchings->size();

for (const auto &waypoint : *waypoints)
for (const auto waypoint : *waypoints)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also clang-related?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, similar errors to above: https://github.com/mjjbell/osrm-backend/runs/2957246502?check_suite_focus=true#step:15:2784

error: loop variable 'destination' is always a copy because the range of type 'const flatbuffers::Vector<flatbuffers::Offsetosrm::engine::api::fbresult::Waypoint >' does not return a reference [-Werror,-Wrange-loop-analysis]
for (const auto &destination : *destinations_array)
^
/Users/runner/work/osrm-backend/osrm-backend/unit_tests/library/table.cpp:335:10: note: use non-reference type 'const osrm::engine::api::fbresult::Waypoint *'
for (const auto &destination : *destinations_array)

CLANG_VERSION: 5.0.0
ENABLE_MASON: ON

- name: gcc-9-release
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can simplify the build matrix a bit and deprecate the older GCCs.

@mjjbell
Copy link
Member Author

mjjbell commented Sep 3, 2021

Thanks for the review @TheMarex!

Replace Travis for continuous integration with Github Actions.
The Github Actions pipeline is functionally equivalent, with
all the same build permutations supported.
Whilst the Github Actions offering is broadly equivalent to
Travis, a few changes have been made as part of the migration.

- The 'core' and 'optional' Travis stages have been consolidated
into one build matrix. This is due to the current inability in
Github Actions to share build steps between jobs, so this avoids
having to duplicate the steps.
Optional stage jobs will now run in parallel with core jobs,
but they still remain optional in the sense that they don't fail
the build.

- A number of existing Github Action plugins are used to replace
functionality provided by Travis or other tools:
Node setup, caching, Codecov, publishing release artifacts.

- Linux builds are updated to build on Ubuntu 18.04.
MacOS builds are updated to run on 10.15. Similar to the
Travis Xenial upgrade attempt, some changes are required due
to underlying platform and compiler upgrades. This means some
Node 10 toolchains will no longer be supported.

Whilst there is opportunity to upgrade some dependencies and
make the CI steps more idiomatic, I've left this for future changes
and just focussed on functional replication.
@mjjbell mjjbell force-pushed the mbell/replace_travis_ga branch from d42cfa6 to c8e35b3 Compare September 3, 2021 11:40
@mjjbell
Copy link
Member Author

mjjbell commented Sep 3, 2021

@TheMarex would you be able to disable Travis CI as a required check? I believe only repo owners have the privileges needed.

It's configured in the Settings page: https://docs.github.com/en/github/administering-a-repository/defining-the-mergeability-of-pull-requests/managing-a-branch-protection-rule

The ci-complete step from Github Actions can be used as a required replacement.

@TheMarex
Copy link
Member

TheMarex commented Sep 3, 2021

@mjjbell Done. I'll merge this now to enable the required ci-complete step.

@TheMarex TheMarex merged commit 0911691 into master Sep 3, 2021
@TheMarex TheMarex deleted the mbell/replace_travis_ga branch September 3, 2021 16:35
@mjjbell mjjbell mentioned this pull request Sep 3, 2021
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Travis Integration is broken
2 participants